[XEN][POWERPC] show symbols in backtrace
authorJimi Xenidis <jimix@watson.ibm.com>
Wed, 23 Aug 2006 09:44:46 +0000 (05:44 -0400)
committerJimi Xenidis <jimix@watson.ibm.com>
Wed, 23 Aug 2006 09:44:46 +0000 (05:44 -0400)
This was already there, just had to hook it up.

Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
.hgignore
xen/arch/powerpc/Makefile
xen/arch/powerpc/backtrace.c
xen/include/asm-powerpc/types.h

index 7625f4fa58b804fcdef7c880b8900f271fe88798..c1abfefb4adc7f5bf8837c74c8c8ba6f2b7d7711 100644 (file)
--- a/.hgignore
+++ b/.hgignore
 ^xen/arch/powerpc/firmware$
 ^xen/arch/powerpc/firmware_image$
 ^xen/arch/powerpc/xen\.lds$
+^xen/arch/powerpc/.xen-syms$
+^xen/arch/powerpc/xen-syms.S$
 ^unmodified_drivers/linux-2.6/\.tmp_versions
 ^unmodified_drivers/linux-2.6/.*\.cmd$
 ^unmodified_drivers/linux-2.6/.*\.ko$
index 86f8fecf67304a43884d716833793cfb7ae151b2..0a338a96dd7d81541bc45ea2b5b29d20a5f1a382 100644 (file)
@@ -95,8 +95,20 @@ boot_of.o: CFLAGS += -DCMDLINE="\"$(IMAGENAME) $(CMDLINE)\""
 start.o: boot/start.S
        $(CC) $(CFLAGS) -D__ASSEMBLY__ -c $< -o $@
 
-$(TARGET)-syms: start.o $(ALL_OBJS) xen.lds
-       $(CC) $(CFLAGS) $(OMAGIC) -Wl,-Ttext,$(xen_link_base),-T,xen.lds start.o $(ALL_OBJS) -o $@
+TARGET_OPTS = $(OMAGIC) -Wl,-Ttext,$(xen_link_base),-T,xen.lds
+TARGET_OPTS += start.o $(ALL_OBJS)
+
+.xen-syms: start.o $(ALL_OBJS) xen.lds
+       $(CC) $(CFLAGS) $(TARGET_OPTS) -o $@
+
+xen-syms.S: .xen-syms
+       $(CROSS_COMPILE)nm --synthetic -n $^ | $(BASEDIR)/tools/symbols > $@
+
+xen-syms.o: xen-syms.S
+       $(CC) $(CFLAGS) -D__ASSEMBLY__ -c $< -o $@
+
+$(TARGET)-syms: start.o $(ALL_OBJS) xen-syms.o xen.lds
+       $(CC) $(CFLAGS) $(TARGET_OPTS) xen-syms.o -o $@
 
 $(TARGET).bin: $(TARGET)-syms
        $(CROSS_COMPILE)objcopy --output-target=binary $< $@
@@ -126,4 +138,4 @@ dom0.bin: $(DOM0_IMAGE)
 
 clean::
        $(MAKE) -f $(BASEDIR)/Rules.mk -C of_handler clean
-       rm -f firmware firmware_image dom0.bin
+       rm -f firmware firmware_image dom0.bin .xen-syms
index 2f4348cebf5583ef3e1e13dcfebb21857a64fa69..da00ccdc0d6a254df54d834fea48ee1a4a946d3f 100644 (file)
@@ -13,6 +13,9 @@
 #include <xen/lib.h>
 #include <xen/console.h>
 #include <xen/sched.h>
+#include <xen/symbols.h>
+
+static char namebuf[KSYM_NAME_LEN+1];
 
 /* Shamelessly lifted from Linux Xmon try to keep pristene */
 #ifdef __powerpc64__
@@ -69,36 +72,32 @@ static int mread(unsigned long adrs, void *buf, int size)
 static void get_function_bounds(unsigned long pc, unsigned long *startp,
                                unsigned long *endp)
 {
-    *startp = pc;
-    *endp = pc;
+    unsigned long size, offset;
+       const char *name;
+
+    *startp = *endp = 0;
+       if (pc == 0)
+               return;
+
+    name = symbols_lookup(pc, &size, &offset, namebuf);
+    if (name != NULL) {
+                       *startp = pc - offset;
+                       *endp = pc - offset + size;
+    }
 }
     
 /* Print an address in numeric and symbolic form (if possible) */
 static void xmon_print_symbol(unsigned long address, const char *mid,
                               const char *after)
 {
-       char *modname;
        const char *name = NULL;
        unsigned long offset, size;
 
        printf(REG, address);
-#if 0
-       if (setjmp(bus_error_jmp) == 0) {
-               catch_memory_errors = 1;
-               sync();
-               name = kallsyms_lookup(address, &size, &offset, &modname,
-                                      tmpstr);
-               sync();
-               /* wait a little while to see if we get a machine check */
-               __delay(200);
-       }
 
-       catch_memory_errors = 0;
-#endif
+    name = symbols_lookup(address, &size, &offset, namebuf);
        if (name) {
                printf("%s%s+%#lx/%#lx", mid, name, offset, size);
-               if (modname)
-                       printf(" [%s]", modname);
        }
        printf("%s", after);
 }
index 4260cd0fa32a3cb4747e06b7dd357a6069a1f4e3..aab8d17e6dec5fcd3e6a84f4b4b2b7abad87511d 100644 (file)
@@ -3,8 +3,18 @@
 #ifndef _PPC_TYPES_H
 #define _PPC_TYPES_H
 
-typedef unsigned short umode_t;
+#include <xen/config.h>
 
+#if defined(__ppc__)
+#define BYTES_PER_LONG 4
+#define BITS_PER_LONG 32
+#elif defined(__PPC64__)
+#define BYTES_PER_LONG 8
+#define BITS_PER_LONG 64
+#endif
+
+#ifndef __ASSEMBLY__
+typedef unsigned short umode_t;
 
 /*
  * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
@@ -31,8 +41,6 @@ typedef unsigned long __u64;
 #endif
 #endif
 
-#include <xen/config.h>
-
 typedef signed char s8;
 typedef unsigned char u8;
 
@@ -45,14 +53,10 @@ typedef unsigned int u32;
 #if defined(__ppc__)
 typedef signed long long s64;
 typedef unsigned long long u64;
-#define BYTES_PER_LONG 4
-#define BITS_PER_LONG 32
 typedef unsigned int size_t;
 #elif defined(__PPC64__)
 typedef signed long s64;
 typedef unsigned long u64;
-#define BYTES_PER_LONG 8
-#define BITS_PER_LONG 64
 typedef unsigned long size_t;
 #endif
 
@@ -66,4 +70,5 @@ typedef u64 dma64_addr_t;
 
 typedef unsigned short xmem_bufctl_t;
 
+#endif  /* __ASSEMBLY__ */
 #endif